package com.tanhua.manager;

import com.tanhua.domain.SummaryVo;
import com.tanhua.domain.YearAmountVo;
import com.tanhua.service.PanelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dashboard")
public class PanelController {

    @Autowired
    private PanelService panelService;

    @GetMapping(value = "/summary", name = "概要统计信息 - 上部分")
    public ResponseEntity summary(){
        SummaryVo vo = panelService.getSummary();
        return ResponseEntity.ok(vo);
    }

    @GetMapping(value = "/users", name = "新增、活跃用户、次日留存率 - 下部分")
    public ResponseEntity user(Long sd, Long ed, Integer type){
        YearAmountVo yearAmountVo = panelService.getUserChartsData(sd, ed, type);
        return ResponseEntity.ok(yearAmountVo);
    }


}
